﻿using Entity;
using Repository;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IService
{
   public interface IWarehouseService
    {
        /// <summary>
        /// 分页查询仓库（基于统一分页实体）
        /// </summary>
        Task<PaginationResult<WarehouseEntity>> GetWarehousePageListAsync(
            string warehouseName,
            int? warehouseStatus,
            int? organizationId,
            string warehouseManager,
            PaginationQuery pagination
        );
        // 调整：将 GetAllUsers 改为异步方法
        Task<List<SysOrgUserManagement>> GetAllUsers();

        // 调整：将 GetAllOrganizations 改为异步方法（保持接口风格一致）
        Task<List<SysOrgOrganizations>> GetAllOrganizations();
        Task AddWarehouseAsync(WarehouseAddDTO dto);
        Task<List<SysOrgUserManagement>> GetWarehouseManagersAsync(); // 新增：获取库位主管用户
        /// <summary>
        /// 获取仓库状态列表
        /// </summary>
        Task<List<WarehouseStatusDTO>> GetWarehouseStatusListAsync();
        /// <summary>
        /// 删除仓库
        /// </summary>
        Task DeleteWarehouseAsync(int warehouseId);
        /// <summary>
        /// 批量更新仓库状态（锁定/启用/停用）
        /// </summary>
        /// <param name="warehouseIds">仓库ID列表</param>
        /// <param name="status">目标状态（0=停用，1=启用，2=锁定）</param>
        /// <returns>操作结果</returns>
        Task<ServiceResult> BatchUpdateStatusAsync(List<int> warehouseIds, int status);
        Task<WarehouseDetailDTO> GetWarehouseDetailAsync(int warehouseId); // 获取仓库详情
        /// <summary>
        /// 根据ID获取仓库编辑信息
        /// </summary>
        Task<WarehouseEditDTO> GetWarehouseForEditAsync(int id);

        /// <summary>
        /// 编辑仓库
        /// </summary>
        Task<ServiceResult> UpdateWarehouseAsync(WarehouseEditDTO dto);
        // 新增：获取所有仓库（用于下拉选择）
        Task<List<WarehouseEntity>> GetAllAsync();
        Task<bool> TestStorageLocationConnection();
        Task<WarehouseEntity> GetByIdAsync(int warehouseId, DbTransaction transaction);
    }
}
